﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using SpLocalizer.Common;
using Microsoft.SharePoint;
using Microsoft.Practices.Unity;

namespace SpLocalizer.ContentSourceProviders.SpListItems
{
    internal class SpListItemStringValueLocalizationTask : SpListItemAbstractValueLocalizationTask
    {
      


        /// <summary>
        /// Constructor without parameters should be public for unity injection
        /// </summary>
        public SpListItemStringValueLocalizationTask() { }


        protected override string GetFieldTextToTranslate(SPListItem item)
        {
            if (item[this.FieldId] != null)
            {
                return item[this.FieldId].ToString();
            }
            else
            {
                return null;
            }
        }

        internal override void SetFieldTextValue(SPListItem item)
        {
            item[this.FieldId] = this.TranslatedText;
        }

    }
}
